<?php
namespace App\Model\Examples;

use PhalApi\Model\NotORMModel as NotORM;

/**
 *热门关键词model
 */

class HotViewKV extends NotORM {

    protected function getTableName($id) {
        return 'hot_view_keyword';
    }
    //获得关键词列表
    public function getHotKeyWordByWord() {
        $total = $this->getORM()
            ->select('title')
            ->order('sort ASC');
        return $total;
    }
    public function getListItems($page, $perpage) {
        return $this->getORM()
            ->select('*')
//            ->where('state', $state)
            ->order('sort ASC')
            ->limit(($page - 1) * $perpage, $perpage)
            ->fetchAll();
    }

    public function getListTotal() {
        $total = $this->getORM()
//            ->where('state', $state)
            ->count('id');

        return intval($total);
    }
}
